#include "mymessagebox.h"

MyMessageBox::MyMessageBox(Icon icon, const QString& title, const QString& text,
                           StandardButtons buttons, QWidget* parent) :
    QMessageBox(icon, title, text, buttons, parent) {
}

MyMessageBox::~MyMessageBox() {
}

void MyMessageBox::showEvent(QShowEvent* event) {
    QWidget* textLabel = findChild<QWidget*>("qt_msgbox_label");       //获取源码中text的label组件
    QWidget* iconLabel = findChild<QWidget*>("qt_msgbox_icon_label");  //获取源码中icon的label组件

    if (textLabel != nullptr) {  //使用指针之前先判断是否为空
        textLabel->setMinimumSize(750, 200);
        // textLabel->setFixedSize(450, 255);
    }
    if (iconLabel != nullptr) {
        iconLabel->setMinimumHeight(200);
        iconLabel->setFixedSize(750, 200);
    }
    QMessageBox::showEvent(event);
}
